// Your code here.

function reverseArray(array) {
    let arr = []
    for (let index = array.length - 1; index >= 0; index--) {
        const element = array[index];
        arr.push(element)
    }
    return arr
}

function reverseArrayInPlace(arr) {

    let i = 0
    let j = arr.length - 1
    // 6/2 3 
    // i<3 
    // if(i%2==0){
    //     // (i+1)/2
    //     // 7/2==3
    //     // i/2== 5/2==2
    //     // 0 1 2 3 4
    //    // 0 1 2 3 4 5
    // }
    // for(let idx=0;idx<(arr.length+1)/2;idx++){
    for (let idx = 0; idx < arr.length / 2; idx++) {
        let t = arr[i]
        arr[i] = arr[j]
        arr[j] = t
        i++
        j--
    }

}
console.log(reverseArray(["A", "B", "C"]));
// → ["C", "B", "A"];
let arrayValue = [1, 2, 3, 4, 5];
reverseArrayInPlace(arrayValue);
console.log(arrayValue);
let arrayValue2 = [1, 2, 3, 4, 5, 6];
reverseArrayInPlace(arrayValue2);
console.log(arrayValue2);
// → [5, 4, 3, 2, 1]